package com.chat.demo.userservice.Entity.Entity;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * friendship
 */
@Data
public class Friendship implements Serializable {
    private Integer relationshipId;

    private Integer userId1;

    private Integer userId2;

    private String status;

    private LocalDateTime createdAt;

    private LocalDateTime updatedAt;

    @Serial
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Friendship other = (Friendship) that;
        return (this.getRelationshipId() == null ? other.getRelationshipId() == null : this.getRelationshipId().equals(other.getRelationshipId()))
            && (this.getUserId1() == null ? other.getUserId1() == null : this.getUserId1().equals(other.getUserId1()))
            && (this.getUserId2() == null ? other.getUserId2() == null : this.getUserId2().equals(other.getUserId2()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRelationshipId() == null) ? 0 : getRelationshipId().hashCode());
        result = prime * result + ((getUserId1() == null) ? 0 : getUserId1().hashCode());
        result = prime * result + ((getUserId2() == null) ? 0 : getUserId2().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", relationshipId=").append(relationshipId);
        sb.append(", userId1=").append(userId1);
        sb.append(", userId2=").append(userId2);
        sb.append(", status=").append(status);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}